import random


def showTitle(title):
    print('%s%s' % ('*' * 11 * 2, '*' * len(title) * 2))
    print('*%s%s%s*' % (' ' * 10, title, ' ' * 10))
    print('%s%s' % ('*' * 11 * 2, '*' * len(title) * 2))


def showCardsInfo(cardsTitle, cards):
    if len(cards) <= 0:
        return

    print(cardsTitle + '：', end='')
    for i in range(len(cards)):
        print('[%d-%s/%s]' % (i + 1, cards[i][0], cards[i][1]), end='')
    print()


def showRoundInfo(roundTitle, wofangCards, duifangCards):
    print(roundTitle)
    showCardsInfo('我方卡牌', wofangCards)
    showCardsInfo('对方卡牌', duifangCards)


def showSkillInfo(card):
    print('%s的技能是：' % card[0], end='')
    for i in range(len(card[2])):
        print('[%d-%s/%s]' % (i + 1, card[2][i][0], card[2][i][1]), end='')
    print()


def attach(roleTitle, gongjifang, beigongjifang):
    if len(gongjifang) <= 0:
        return

    print(roleTitle)
    if roleTitle == '[我方攻击]':
        gongji = int(input('请选择我方攻击卡牌：'))
        showSkillInfo(gongjifang[gongji - 1])
        jineng = int(input('请选择攻击技能：'))
        beigongji = int(input('请选择对方被攻击卡牌：'))
    else:
        gongji = random.randint(1, len(gongjifang))
        jineng = random.randint(1, len(gongjifang[gongji - 1][2]))
        beigongji = random.randint(1, len(beigongjifang))
    beigongjifang[beigongji - 1][1] -= gongjifang[gongji - 1][2][jineng - 1][1]

    if beigongjifang[beigongji - 1][1] <= 0:
        print('[%d-%s]攻击了[%d-%s]，[%d-%s]受到[%d]点伤害，弃牌' % (
            gongji, gongjifang[gongji - 1][0],
            beigongji, beigongjifang[beigongji - 1][0],
            beigongji, beigongjifang[beigongji - 1][0],
            gongjifang[gongji - 1][2][jineng - 1][1]))
        beigongjifang.pop(beigongji - 1)
    else:
        print('[%d-%s]使用[%s]攻击了[%d-%s]，[%d-%s]受到[%d]点伤害，生命值还剩%d' % (
            gongji, gongjifang[gongji - 1][0],
            gongjifang[gongji - 1][2][jineng - 1][0],
            beigongji, beigongjifang[beigongji - 1][0],
            beigongji, beigongjifang[beigongji - 1][0],
            gongjifang[gongji - 1][2][jineng - 1][1],
            beigongjifang[beigongji - 1][1]))


def showEndGame(duifangpai):
    if len(duifangpai) <= 0:
        showTitle('我方大获全胜！')
    else:
        showTitle('lose')


wofangCards = [['皇女', 10, [['普通攻击', 2], ['召唤奥兹', 3], ['变鸟巡逻', 5]]],
               ['迪老爷', 10, [['普通攻击', 1], ['火焰刀', 3], ['大烧鸡', 8]]],
               ['凯亚', 10, [['普通攻击', 2], ['冰冻西瓜', 3], ['冰镇呼啦圈', 3]]]]
duifangCards = [['火邱邱人', 3, [['普通攻击', 1], ['史莱姆炸弹', 3], ['我是大疯子', 4]]],
                ['岩邱邱铠王', 8, [['普通攻击', 3], ['岩石四起', 5], ['岩石冲撞', 6]]],
                ['冰邱邱弓箭手', 3, [['普通攻击', 2], ['冰箭雨', 5]]]]
lun = 0

showTitle('七圣召唤，派蒙乱蹿！')
showRoundInfo('[牌局开始]', wofangCards, duifangCards)
while len(wofangCards) > 0 and len(duifangCards) > 0:
    print('--------------------第%d轮-开始--------------------' % (lun + 1))
    attach('[我方攻击]', wofangCards, duifangCards)
    attach('[对方攻击]', duifangCards, wofangCards)
    print('--------------------第%d轮-结束--------------------' % (lun + 1))
    showRoundInfo('[战斗结果]', wofangCards, duifangCards)
    print('*' * 50)
    lun += 1
showEndGame(duifangCards)
